%%%-------------------------------------------------------------------
%%% @author Administrator
%%% @copyright (C) 2023, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 12. 4月 2023 14:53
%%%-------------------------------------------------------------------
-module(sc_element_sup).
-behaviour(supervisor).
-export([start_link/0,
  start_child/2 % 动态启动子进程
]).
-export([init/1]).
-define(SERVER, ?MODULE).
start_link() ->
  supervisor:start_link({local, ?SERVER}, ?MODULE, []).
start_child(Value, LeaseTime) ->
  supervisor:start_child(?SERVER, [Value, LeaseTime]). % sc_element:start_link/2的参数
init([]) ->
  Element = {sc_element, {sc_element, start_link, []},
    temporary, brutal_kill, worker, [sc_element]},
  Children = [Element],
  RestartStrategy = {simple_one_for_one, 0, 1},
  {ok, {RestartStrategy, Children}}.
